using SM.core;
using SS;
using System;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Windows.Forms;
using TVSBH.core;
namespace TVSBH.func
{
	public class frmBill : Form
	{
		private Func objFunc = new Func();
		private DataTable objTable = new DataTable();
		private DataTable objTableBill = new DataTable();
		private Bill objBill = new Bill();
		private Partner objPartner = new Partner();
		private string providerAddress = "";
		private string providerPhone = "";
		private string cusAddress = "";
		private string cusPhone = "";
		private string currWhID = "";
		public string userName = "";
		public string fullName = "";
		private IContainer components = null;
		private DataGridView dgvProduct;
		private Button btnPrint;
		private Button btnClose;
		private DataGridView dgvBill;
		private GroupBox groupBox1;
		private TextBox txtNote;
		private Label label8;
		private TextBox txtTotalMoney;
		private Label label7;
		private TextBox txtDebt;
		private Label label6;
		private ComboBox cbbProvider;
		private Label lblObject;
		private ComboBox cbbWareHouse;
		private ComboBox cbbTypeInput;
		private Label label3;
		private Label label4;
		private Label label2;
		private DateTimePicker txtDate;
		private TextBox txtID;
		private Label label1;
		private ComboBox cbbTypeBill;
		private GroupBox groupBox2;
		private Label lblObjectSearch;
		private TextBox txtSearch;
		private Button btnSearch;
		private Label label25;
		private Label label17;
		private DateTimePicker dtpTo;
		private DateTimePicker dtpFrom;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
		private DataGridViewTextBoxColumn Column10;
		private DataGridViewTextBoxColumn Column11;
		private DataGridViewTextBoxColumn Column12;
		private DataGridViewTextBoxColumn Column13;
		private DataGridViewTextBoxColumn Column14;
		private DataGridViewTextBoxColumn Column2;
		private DataGridViewTextBoxColumn Column3;
		private DataGridViewTextBoxColumn Column1;
		private DataGridViewTextBoxColumn Column4;
		private DataGridViewTextBoxColumn Column5;
		private DataGridViewTextBoxColumn Column6;
		private DataGridViewTextBoxColumn Column7;
		private DataGridViewTextBoxColumn Column8;
		private DataGridViewTextBoxColumn Column9;
		private Label label5;
		public frmBill()
		{
			this.InitializeComponent();
		}
		private void frmInput_Load(object sender, EventArgs e)
		{
			this.currWhID = this.objFunc.getWarehouse(this.userName);
			this.cbbTypeBill.SelectedIndex = 0;
		}
		private void btnClose_Click(object sender, EventArgs e)
		{
			base.Close();
		}
		private void frmInput_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Escape)
			{
				base.Close();
			}
			else
			{
				if (e.KeyCode == Keys.F7)
				{
					this.btnPrint.PerformClick();
				}
			}
		}
		private int checkInObjTable(string Pid)
		{
			int num = -1;
			int result;
			for (int i = 0; i < this.objTable.Rows.Count; i++)
			{
				if (this.objTable.Rows[i]["Pid"].ToString() == Pid)
				{
					num = i;
					result = num;
					return result;
				}
			}
			result = num;
			return result;
		}
		private double checkMoneyOfBill()
		{
			double num = 0.0;
			for (int i = 0; i < this.objTable.Rows.Count; i++)
			{
				num += double.Parse(this.objTable.Rows[i]["ProductMoney"].ToString());
			}
			return num;
		}
		private void btnAdd_Click(object sender, EventArgs e)
		{
			this.objTable = new DataTable();
			DataColumn column = new DataColumn("Pid", typeof(string));
			DataColumn column2 = new DataColumn("ProductName", typeof(string));
			DataColumn column3 = new DataColumn("ProductUnit", typeof(string));
			DataColumn column4 = new DataColumn("ProductNumber", typeof(string));
			DataColumn column5 = new DataColumn("ProductPrice", typeof(string));
			DataColumn column6 = new DataColumn("ProductMoney", typeof(string));
			DataColumn column7 = new DataColumn("Packet", typeof(string));
			DataColumn column8 = new DataColumn("ProductDate", typeof(DateTime));
			DataColumn column9 = new DataColumn("ProductExpiryDate", typeof(DateTime));
			this.objTable.Columns.Add(column);
			this.objTable.Columns.Add(column2);
			this.objTable.Columns.Add(column3);
			this.objTable.Columns.Add(column4);
			this.objTable.Columns.Add(column5);
			this.objTable.Columns.Add(column6);
			this.objTable.Columns.Add(column7);
			this.objTable.Columns.Add(column8);
			this.objTable.Columns.Add(column9);
			this.dgvProduct.DataSource = this.objTable;
			this.btnPrint.Enabled = false;
		}
		private void getBillInput(string objectName)
		{
			try
			{
				this.objTableBill = new DataTable();
				this.dgvBill.AutoGenerateColumns = false;
				SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
				string cmdText;
				if (objectName.Trim() == "")
				{
					cmdText = "SELECT * FROM [TabBill] WHERE TypeInput IN ('IN1','IN2','IN3') AND [WID] = '" + this.currWhID + "' AND CreateDate BETWEEN @ObjDate1 AND @objDate2 ORDER BY [CreateDate] DESC";
				}
				else
				{
					cmdText = string.Concat(new string[]
					{
						"SELECT * FROM [TabBill],[TabPartner] WHERE [TabPartner].[ProID] = [TabBill].[PID] AND UPPER([Name]) LIKE N'%",
						objectName.ToUpper(),
						"%' AND TypeInput IN ('IN1','IN2','IN3') AND [WID] = '",
						this.currWhID,
						"' AND CreateDate BETWEEN @ObjDate1 AND @objDate2 ORDER BY [CreateDate] DESC"
					});
				}
				SqlCommand sqlCommand = new SqlCommand(cmdText, sqlConnection);
				SqlParameter sqlParameter = new SqlParameter("ObjDate1", SqlDbType.DateTime);
				SqlParameter sqlParameter2 = new SqlParameter("ObjDate2", SqlDbType.DateTime);
				sqlParameter.Value = DateTime.Parse(this.dtpFrom.Value.ToString().Substring(0, 10) + " 00:00:00 AM");
				sqlParameter2.Value = DateTime.Parse(this.dtpTo.Value.ToString().Substring(0, 10) + " 11:59:59 PM");
				sqlCommand.Parameters.Add(sqlParameter);
				sqlCommand.Parameters.Add(sqlParameter2);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				DataSet dataSet = new DataSet();
				sqlConnection.Open();
				sqlDataAdapter.Fill(dataSet);
				this.objTableBill = dataSet.Tables[0];
				this.dgvBill.DataSource = this.objTableBill;
				sqlConnection.Close();
				sqlConnection.Dispose();
				sqlDataAdapter.Dispose();
				dataSet.Dispose();
			}
			catch
			{
			}
		}
		private void getBillOutput(string objectName)
		{
			try
			{
				this.objTableBill = new DataTable();
				this.dgvBill.AutoGenerateColumns = false;
				SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
				string cmdText;
				if (objectName.Trim() == "")
				{
					cmdText = "SELECT * FROM [TabBill] WHERE [WID] = '" + this.currWhID + "' AND TypeInput IN ('OUT1','OUT2','OUT3') AND CreateDate BETWEEN @ObjDate1 AND @objDate2 ORDER BY [CreateDate] DESC";
				}
				else
				{
					cmdText = string.Concat(new string[]
					{
						"SELECT * FROM [TabBill],[TabPartner] WHERE  [TabBill].[WID] = '",
						this.currWhID,
						"' AND [TabPartner].[CusID] = [TabBill].[PID] AND UPPER([Name]) LIKE N'%",
						objectName.ToUpper(),
						"%' AND TypeInput IN ('IN1','IN2','IN3') AND CreateDate BETWEEN @ObjDate1 AND @objDate2 ORDER BY [CreateDate] DESC"
					});
				}
				SqlCommand sqlCommand = new SqlCommand(cmdText, sqlConnection);
				SqlParameter sqlParameter = new SqlParameter("ObjDate1", SqlDbType.DateTime);
				SqlParameter sqlParameter2 = new SqlParameter("ObjDate2", SqlDbType.DateTime);
				sqlParameter.Value = DateTime.Parse(this.dtpFrom.Value.ToString().Substring(0, 10) + " 00:00:00 AM");
				sqlParameter2.Value = DateTime.Parse(this.dtpTo.Value.ToString().Substring(0, 10) + " 11:59:59 PM");
				sqlCommand.Parameters.Add(sqlParameter);
				sqlCommand.Parameters.Add(sqlParameter2);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				DataSet dataSet = new DataSet();
				sqlConnection.Open();
				sqlDataAdapter.Fill(dataSet);
				this.objTableBill = dataSet.Tables[0];
				this.dgvBill.DataSource = this.objTableBill;
				sqlConnection.Close();
				sqlConnection.Dispose();
				sqlDataAdapter.Dispose();
				dataSet.Dispose();
			}
			catch
			{
			}
		}
		private void dgvBill_CellEnter(object sender, DataGridViewCellEventArgs e)
		{
			this.dgvProduct.AutoGenerateColumns = false;
			this.txtID.Text = this.objTableBill.Rows[e.RowIndex]["ID"].ToString();
			this.txtDate.Value = DateTime.Parse(this.objTableBill.Rows[e.RowIndex]["CreateDate"].ToString());
			this.txtTotalMoney.Text = this.objTableBill.Rows[e.RowIndex]["TotalMoney"].ToString();
			this.cbbTypeInput.SelectedValue = this.objTableBill.Rows[e.RowIndex]["TypeInput"].ToString();
			this.cbbWareHouse.SelectedValue = this.objTableBill.Rows[e.RowIndex]["WID"].ToString();
			this.cbbProvider.SelectedValue = this.objTableBill.Rows[e.RowIndex]["PID"].ToString();
			this.txtNote.Text = this.objTableBill.Rows[e.RowIndex]["Note"].ToString();
			this.objTable = new DataTable();
			this.objTable = this.objBill.getDetailBill(this.txtID.Text);
			this.dgvProduct.DataSource = this.objTable;
			this.dgvProduct.Refresh();
			this.getObjectInfo();
			this.txtID.ReadOnly = true;
			this.btnPrint.Enabled = true;
		}
		private void btnEdit_Click(object sender, EventArgs e)
		{
			this.btnPrint.Enabled = true;
		}
		private void dtpSelectMonth_ValueChanged(object sender, EventArgs e)
		{
			this.getBill(this.txtSearch.Text);
		}
		private void dgvProduct_KeyPress(object sender, KeyPressEventArgs e)
		{
			MessageBox.Show(e.KeyChar.ToString());
		}
		private void btnDel_Click(object sender, EventArgs e)
		{
			if (MessageBox.Show("Bạn có chắc chắn muốn xoá hoá đơn [ " + this.txtID.Text.ToUpper() + " ] không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
			{
				this.objBill.delItem(this.txtID.Text);
				this.getBill(this.txtSearch.Text);
			}
		}
		private void btnPrint_Click(object sender, EventArgs e)
		{
			if (this.dgvProduct.RowCount > 0)
			{
				if (this.cbbTypeBill.SelectedIndex == 1)
				{
					frmInputBill.objTable = new DataTable();
					frmInputView frmInputView = new frmInputView();
					frmInputView.billID = this.txtID.Text;
					frmInputView.billDate = this.txtDate.Text;
					frmInputView.billNote = this.txtNote.Text;
					frmInputView.billTotalMoney = this.txtTotalMoney.Text;
					frmInputView.providerName = this.cbbProvider.Text;
					frmInputView.providerAddress = this.providerAddress;
					frmInputView.providerPhone = this.providerPhone;
					frmInputView.Debt = this.txtDebt.Text;
					frmInputView.ALl = (double.Parse(this.txtTotalMoney.Text) + double.Parse(this.txtDebt.Text)).ToString();
					frmInputBill.objTable = this.objTable;
					frmInputView.ShowDialog();
				}
				else
				{
					if (this.cbbTypeBill.SelectedIndex == 2)
					{
						frmOutputBill.objTable = new DataTable();
						frmOutputView frmOutputView = new frmOutputView();
						frmOutputView.billID = this.txtID.Text;
						frmOutputView.billDate = this.txtDate.Text;
						frmOutputView.billNote = this.txtNote.Text;
						frmOutputView.billTotalMoney = this.txtTotalMoney.Text;
						frmOutputView.cusName = this.cbbProvider.Text;
						frmOutputView.cusAddress = this.cusAddress;
						frmOutputView.cusPhone = this.cusPhone;
						frmOutputView.Debt = this.txtDebt.Text;
						frmOutputView.ALl = (double.Parse(this.txtTotalMoney.Text) + double.Parse(this.txtDebt.Text)).ToString();
						frmOutputBill.objTable = this.objTable;
						frmOutputView.ShowDialog();
					}
					else
					{
						MessageBox.Show("Chưa xác định kiểu hoá đơn cần in", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					}
				}
				try
				{
					this.dgvProduct.Columns["TT"].Visible = false;
				}
				catch
				{
				}
				this.objBill.setPrinted(this.txtID.Text);
			}
		}
		private void cbbTypeBill_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.getBill(this.txtSearch.Text);
		}
		private void getBill(string objectName)
		{
			if (this.cbbTypeBill.SelectedIndex == 1)
			{
				this.lblObject.Text = "Nhà cung cấp : ";
				this.lblObjectSearch.Text = "Nhà cung cấp :";
				this.objFunc.LoadComboBox("SELECT * FROM [TabPartner] WHERE [IsProvider] = 1", this.cbbProvider, "CusID", "Name");
				this.dgvProduct.DataSource = null;
				this.getBillInput(objectName);
			}
			else
			{
				if (this.cbbTypeBill.SelectedIndex == 2)
				{
					this.lblObject.Text = "Khách hàng : ";
					this.lblObjectSearch.Text = "Khách hàng :";
					this.objFunc.LoadComboBox("SELECT * FROM [TabPartner] WHERE [IsCustomer] = 1", this.cbbProvider, "CusID", "Name");
					this.dgvProduct.DataSource = null;
					this.getBillOutput(objectName);
				}
				else
				{
					this.lblObjectSearch.Text = "Tên tìm kiếm :";
					this.resetDataGridView();
				}
			}
		}
		private void resetDataGridView()
		{
			this.objTable = null;
			this.objTableBill = null;
			this.dgvProduct.DataSource = this.objTable;
			this.dgvBill.DataSource = this.objTableBill;
		}
		private void cbbProvider_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.getObjectInfo();
		}
		private void getObjectInfo()
		{
			try
			{
				if (this.cbbTypeBill.SelectedIndex == 1)
				{
					double num = this.objPartner.getFistBalanceProvider(this.cbbProvider.SelectedValue.ToString()) + this.objPartner.getTotalMoney(this.cbbProvider.SelectedValue.ToString(), this.txtDate.Value);
					this.txtDebt.Text = num.ToString();
					this.providerAddress = this.objPartner.getAddress(this.cbbProvider.SelectedValue.ToString());
					this.providerPhone = this.objPartner.getPhone(this.cbbProvider.SelectedValue.ToString());
				}
				else
				{
					double num = this.objPartner.getFistBalanceCustomer(this.cbbProvider.SelectedValue.ToString()) + this.objPartner.getTotalMoney(this.cbbProvider.SelectedValue.ToString(), this.txtDate.Value);
					this.txtDebt.Text = num.ToString();
					this.cusAddress = this.objPartner.getAddress1(this.cbbProvider.SelectedValue.ToString());
					this.cusPhone = this.objPartner.getPhone1(this.cbbProvider.SelectedValue.ToString());
				}
			}
			catch
			{
			}
		}
		private void btnSearch_Click(object sender, EventArgs e)
		{
			this.getBill(this.txtSearch.Text);
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle7 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle8 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle9 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle10 = new DataGridViewCellStyle();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(frmBill));
			this.dgvProduct = new DataGridView();
			this.Column2 = new DataGridViewTextBoxColumn();
			this.Column3 = new DataGridViewTextBoxColumn();
			this.Column1 = new DataGridViewTextBoxColumn();
			this.Column4 = new DataGridViewTextBoxColumn();
			this.Column5 = new DataGridViewTextBoxColumn();
			this.Column6 = new DataGridViewTextBoxColumn();
			this.Column7 = new DataGridViewTextBoxColumn();
			this.Column8 = new DataGridViewTextBoxColumn();
			this.Column9 = new DataGridViewTextBoxColumn();
			this.btnPrint = new Button();
			this.btnClose = new Button();
			this.dgvBill = new DataGridView();
			this.dataGridViewTextBoxColumn1 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn7 = new DataGridViewTextBoxColumn();
			this.Column10 = new DataGridViewTextBoxColumn();
			this.Column11 = new DataGridViewTextBoxColumn();
			this.Column12 = new DataGridViewTextBoxColumn();
			this.Column13 = new DataGridViewTextBoxColumn();
			this.Column14 = new DataGridViewTextBoxColumn();
			this.groupBox1 = new GroupBox();
			this.txtNote = new TextBox();
			this.label8 = new Label();
			this.txtTotalMoney = new TextBox();
			this.label7 = new Label();
			this.txtDebt = new TextBox();
			this.label6 = new Label();
			this.cbbWareHouse = new ComboBox();
			this.cbbTypeInput = new ComboBox();
			this.label3 = new Label();
			this.label4 = new Label();
			this.label2 = new Label();
			this.txtDate = new DateTimePicker();
			this.txtID = new TextBox();
			this.label1 = new Label();
			this.cbbProvider = new ComboBox();
			this.lblObject = new Label();
			this.cbbTypeBill = new ComboBox();
			this.groupBox2 = new GroupBox();
			this.label25 = new Label();
			this.label17 = new Label();
			this.dtpTo = new DateTimePicker();
			this.dtpFrom = new DateTimePicker();
			this.btnSearch = new Button();
			this.txtSearch = new TextBox();
			this.lblObjectSearch = new Label();
			this.label5 = new Label();
			((ISupportInitialize)this.dgvProduct).BeginInit();
			((ISupportInitialize)this.dgvBill).BeginInit();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			base.SuspendLayout();
			this.dgvProduct.AllowUserToAddRows = false;
			this.dgvProduct.AllowUserToDeleteRows = false;
			this.dgvProduct.AllowUserToOrderColumns = true;
			this.dgvProduct.AllowUserToResizeColumns = false;
			this.dgvProduct.AllowUserToResizeRows = false;
			dataGridViewCellStyle.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle;
			this.dgvProduct.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.dgvProduct.BackgroundColor = Color.White;
			this.dgvProduct.BorderStyle = BorderStyle.Fixed3D;
			this.dgvProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvProduct.Columns.AddRange(new DataGridViewColumn[]
			{
				this.Column2,
				this.Column3,
				this.Column1,
				this.Column4,
				this.Column5,
				this.Column6,
				this.Column7,
				this.Column8,
				this.Column9
			});
			this.dgvProduct.Cursor = Cursors.Hand;
			this.dgvProduct.EnableHeadersVisualStyles = false;
			this.dgvProduct.Location = new System.Drawing.Point(233, 62);
			this.dgvProduct.MultiSelect = false;
			this.dgvProduct.Name = "dgvProduct";
			this.dgvProduct.ReadOnly = true;
			this.dgvProduct.RowHeadersVisible = false;
			this.dgvProduct.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			dataGridViewCellStyle2.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.RowsDefaultCellStyle = dataGridViewCellStyle2;
			this.dgvProduct.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvProduct.Size = new Size(660, 497);
			this.dgvProduct.TabIndex = 1;
			this.Column2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.Column2.DataPropertyName = "productName";
			this.Column2.HeaderText = "Sản phẩm";
			this.Column2.Name = "Column2";
			this.Column2.ReadOnly = true;
			this.Column2.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column3.DataPropertyName = "productUnit";
			this.Column3.HeaderText = "Đơn vị tính";
			this.Column3.MinimumWidth = 110;
			this.Column3.Name = "Column3";
			this.Column3.ReadOnly = true;
			this.Column3.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column3.Width = 110;
			this.Column1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column1.DataPropertyName = "Packet";
			this.Column1.HeaderText = "Số lô";
			this.Column1.MinimumWidth = 120;
			this.Column1.Name = "Column1";
			this.Column1.ReadOnly = true;
			this.Column1.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column1.Width = 120;
			this.Column4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column4.DataPropertyName = "productNumber";
			dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle3.Format = "N0";
			dataGridViewCellStyle3.NullValue = null;
			this.Column4.DefaultCellStyle = dataGridViewCellStyle3;
			this.Column4.HeaderText = "Số lượng";
			this.Column4.MinimumWidth = 85;
			this.Column4.Name = "Column4";
			this.Column4.ReadOnly = true;
			this.Column4.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column4.Width = 85;
			this.Column5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column5.DataPropertyName = "productPrice";
			dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle4.Format = "N0";
			dataGridViewCellStyle4.NullValue = null;
			this.Column5.DefaultCellStyle = dataGridViewCellStyle4;
			this.Column5.HeaderText = "Đơn giá";
			this.Column5.MinimumWidth = 100;
			this.Column5.Name = "Column5";
			this.Column5.ReadOnly = true;
			this.Column5.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column6.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column6.DataPropertyName = "ProductMoney";
			dataGridViewCellStyle5.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle5.Format = "N0";
			dataGridViewCellStyle5.NullValue = null;
			this.Column6.DefaultCellStyle = dataGridViewCellStyle5;
			this.Column6.HeaderText = "Thành tiền";
			this.Column6.MinimumWidth = 100;
			this.Column6.Name = "Column6";
			this.Column6.ReadOnly = true;
			this.Column6.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column7.DataPropertyName = "ProductDate";
			dataGridViewCellStyle6.Format = "dd/MM/yyyy";
			this.Column7.DefaultCellStyle = dataGridViewCellStyle6;
			this.Column7.HeaderText = "Ngày SX";
			this.Column7.MinimumWidth = 85;
			this.Column7.Name = "Column7";
			this.Column7.ReadOnly = true;
			this.Column7.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column7.Visible = false;
			this.Column7.Width = 85;
			this.Column8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column8.DataPropertyName = "ProductExpiryDate";
			dataGridViewCellStyle7.Format = "dd/MM/yyyy";
			this.Column8.DefaultCellStyle = dataGridViewCellStyle7;
			this.Column8.HeaderText = "Hạn dùng";
			this.Column8.MinimumWidth = 85;
			this.Column8.Name = "Column8";
			this.Column8.ReadOnly = true;
			this.Column8.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column8.Visible = false;
			this.Column8.Width = 85;
			this.Column9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column9.DataPropertyName = "Pid";
			this.Column9.HeaderText = "Mã sản phẩm";
			this.Column9.Name = "Column9";
			this.Column9.ReadOnly = true;
			this.Column9.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column9.Visible = false;
			this.btnPrint.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnPrint.BackColor = SystemColors.ButtonFace;
			this.btnPrint.Enabled = false;
			this.btnPrint.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnPrint.FlatStyle = FlatStyle.Flat;
			this.btnPrint.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnPrint.Location = new System.Drawing.Point(236, 565);
			this.btnPrint.Name = "btnPrint";
			this.btnPrint.Size = new Size(102, 26);
			this.btnPrint.TabIndex = 36;
			this.btnPrint.Text = "Xem và in [ F7 ]";
			this.btnPrint.UseVisualStyleBackColor = false;
			this.btnPrint.Click += new EventHandler(this.btnPrint_Click);
			this.btnClose.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnClose.BackColor = SystemColors.ButtonFace;
			this.btnClose.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnClose.FlatStyle = FlatStyle.Flat;
			this.btnClose.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnClose.Location = new System.Drawing.Point(790, 565);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new Size(100, 26);
			this.btnClose.TabIndex = 38;
			this.btnClose.Text = "Thoát  [ ESC ]";
			this.btnClose.UseVisualStyleBackColor = false;
			this.btnClose.Click += new EventHandler(this.btnClose_Click);
			this.dgvBill.AllowUserToAddRows = false;
			this.dgvBill.AllowUserToDeleteRows = false;
			this.dgvBill.AllowUserToOrderColumns = true;
			this.dgvBill.AllowUserToResizeColumns = false;
			this.dgvBill.AllowUserToResizeRows = false;
			dataGridViewCellStyle8.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle8.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvBill.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle8;
			this.dgvBill.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left);
			this.dgvBill.BackgroundColor = Color.White;
			this.dgvBill.BorderStyle = BorderStyle.Fixed3D;
			this.dgvBill.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvBill.Columns.AddRange(new DataGridViewColumn[]
			{
				this.dataGridViewTextBoxColumn1,
				this.dataGridViewTextBoxColumn7,
				this.Column10,
				this.Column11,
				this.Column12,
				this.Column13,
				this.Column14
			});
			this.dgvBill.Cursor = Cursors.Hand;
			this.dgvBill.EnableHeadersVisualStyles = false;
			this.dgvBill.Location = new System.Drawing.Point(7, 62);
			this.dgvBill.MultiSelect = false;
			this.dgvBill.Name = "dgvBill";
			this.dgvBill.ReadOnly = true;
			this.dgvBill.RowHeadersVisible = false;
			this.dgvBill.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			dataGridViewCellStyle9.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvBill.RowsDefaultCellStyle = dataGridViewCellStyle9;
			this.dgvBill.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvBill.Size = new Size(220, 532);
			this.dgvBill.TabIndex = 39;
			this.dgvBill.CellEnter += new DataGridViewCellEventHandler(this.dgvBill_CellEnter);
			this.dataGridViewTextBoxColumn1.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.dataGridViewTextBoxColumn1.DataPropertyName = "ID";
			this.dataGridViewTextBoxColumn1.HeaderText = "Hoá đơn";
			this.dataGridViewTextBoxColumn1.MinimumWidth = 120;
			this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
			this.dataGridViewTextBoxColumn1.ReadOnly = true;
			this.dataGridViewTextBoxColumn7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn7.DataPropertyName = "CreateDate";
			dataGridViewCellStyle10.Format = "D";
			dataGridViewCellStyle10.NullValue = null;
			this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle10;
			this.dataGridViewTextBoxColumn7.HeaderText = "Ngày lập";
			this.dataGridViewTextBoxColumn7.MinimumWidth = 82;
			this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
			this.dataGridViewTextBoxColumn7.ReadOnly = true;
			this.dataGridViewTextBoxColumn7.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn7.Width = 82;
			this.Column10.DataPropertyName = "TotalMoney";
			this.Column10.HeaderText = "TotalMoney";
			this.Column10.Name = "Column10";
			this.Column10.ReadOnly = true;
			this.Column10.Visible = false;
			this.Column11.DataPropertyName = "TypeInput";
			this.Column11.HeaderText = "TypeInput";
			this.Column11.Name = "Column11";
			this.Column11.ReadOnly = true;
			this.Column11.Visible = false;
			this.Column12.DataPropertyName = "WID";
			this.Column12.HeaderText = "WID";
			this.Column12.Name = "Column12";
			this.Column12.ReadOnly = true;
			this.Column12.Visible = false;
			this.Column13.DataPropertyName = "Note";
			this.Column13.HeaderText = "Note";
			this.Column13.Name = "Column13";
			this.Column13.ReadOnly = true;
			this.Column13.Visible = false;
			this.Column14.DataPropertyName = "PID";
			this.Column14.HeaderText = "PID";
			this.Column14.Name = "Column14";
			this.Column14.ReadOnly = true;
			this.Column14.Visible = false;
			this.groupBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.groupBox1.Controls.Add(this.txtNote);
			this.groupBox1.Controls.Add(this.label8);
			this.groupBox1.Controls.Add(this.txtTotalMoney);
			this.groupBox1.Controls.Add(this.label7);
			this.groupBox1.Controls.Add(this.txtDebt);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Controls.Add(this.cbbWareHouse);
			this.groupBox1.Controls.Add(this.cbbTypeInput);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.txtDate);
			this.groupBox1.Controls.Add(this.txtID);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Location = new System.Drawing.Point(233, 293);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new Size(660, 114);
			this.groupBox1.TabIndex = 41;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Thông tin đơn hàng";
			this.txtNote.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtNote.Location = new System.Drawing.Point(297, 80);
			this.txtNote.Name = "txtNote";
			this.txtNote.Size = new Size(355, 21);
			this.txtNote.TabIndex = 6;
			this.label8.AutoSize = true;
			this.label8.Location = new System.Drawing.Point(232, 83);
			this.label8.Name = "label8";
			this.label8.Size = new Size(62, 15);
			this.label8.TabIndex = 16;
			this.label8.Text = "Diễn giải :";
			this.txtTotalMoney.BackColor = Color.White;
			this.txtTotalMoney.Location = new System.Drawing.Point(125, 80);
			this.txtTotalMoney.Name = "txtTotalMoney";
			this.txtTotalMoney.ReadOnly = true;
			this.txtTotalMoney.Size = new Size(100, 21);
			this.txtTotalMoney.TabIndex = 15;
			this.txtTotalMoney.Text = "0";
			this.txtTotalMoney.TextAlign = HorizontalAlignment.Right;
			this.label7.AutoSize = true;
			this.label7.Location = new System.Drawing.Point(58, 83);
			this.label7.Name = "label7";
			this.label7.Size = new Size(64, 15);
			this.label7.TabIndex = 14;
			this.label7.Text = "Tổng tiền :";
			this.txtDebt.BackColor = Color.White;
			this.txtDebt.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.txtDebt.ForeColor = Color.FromArgb(0, 0, 192);
			this.txtDebt.Location = new System.Drawing.Point(567, 51);
			this.txtDebt.Name = "txtDebt";
			this.txtDebt.ReadOnly = true;
			this.txtDebt.Size = new Size(85, 21);
			this.txtDebt.TabIndex = 13;
			this.txtDebt.Text = "0";
			this.txtDebt.TextAlign = HorizontalAlignment.Right;
			this.label6.AutoSize = true;
			this.label6.Location = new System.Drawing.Point(502, 54);
			this.label6.Name = "label6";
			this.label6.Size = new Size(61, 15);
			this.label6.TabIndex = 12;
			this.label6.Text = "Công nợ :";
			this.cbbWareHouse.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbWareHouse.FormattingEnabled = true;
			this.cbbWareHouse.Location = new System.Drawing.Point(297, 50);
			this.cbbWareHouse.Name = "cbbWareHouse";
			this.cbbWareHouse.Size = new Size(173, 23);
			this.cbbWareHouse.TabIndex = 4;
			this.cbbTypeInput.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbTypeInput.FormattingEnabled = true;
			this.cbbTypeInput.Location = new System.Drawing.Point(297, 21);
			this.cbbTypeInput.Name = "cbbTypeInput";
			this.cbbTypeInput.Size = new Size(173, 23);
			this.cbbTypeInput.TabIndex = 3;
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(228, 54);
			this.label3.Name = "label3";
			this.label3.Size = new Size(66, 15);
			this.label3.TabIndex = 7;
			this.label3.Text = "Kho hàng :";
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(231, 25);
			this.label4.Name = "label4";
			this.label4.Size = new Size(63, 15);
			this.label4.TabIndex = 4;
			this.label4.Text = "Quy cách :";
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(50, 54);
			this.label2.Name = "label2";
			this.label2.Size = new Size(72, 15);
			this.label2.TabIndex = 3;
			this.label2.Text = "Ngày nhập :";
			this.txtDate.CustomFormat = "dd/MM/yyyy";
			this.txtDate.Format = DateTimePickerFormat.Custom;
			this.txtDate.Location = new System.Drawing.Point(125, 51);
			this.txtDate.Name = "txtDate";
			this.txtDate.Size = new Size(100, 21);
			this.txtDate.TabIndex = 2;
			this.txtID.BackColor = Color.White;
			this.txtID.CharacterCasing = CharacterCasing.Upper;
			this.txtID.Location = new System.Drawing.Point(125, 22);
			this.txtID.Name = "txtID";
			this.txtID.ReadOnly = true;
			this.txtID.Size = new Size(100, 21);
			this.txtID.TabIndex = 1;
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(11, 25);
			this.label1.Name = "label1";
			this.label1.Size = new Size(111, 15);
			this.label1.TabIndex = 0;
			this.label1.Text = "Số hiệu đơn hàng :";
			this.cbbProvider.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.cbbProvider.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbProvider.FormattingEnabled = true;
			this.cbbProvider.Location = new System.Drawing.Point(533, 147);
			this.cbbProvider.Name = "cbbProvider";
			this.cbbProvider.Size = new Size(337, 23);
			this.cbbProvider.TabIndex = 5;
			this.cbbProvider.SelectedIndexChanged += new EventHandler(this.cbbProvider_SelectedIndexChanged);
			this.lblObject.Location = new System.Drawing.Point(438, 155);
			this.lblObject.Name = "lblObject";
			this.lblObject.Size = new Size(89, 15);
			this.lblObject.TabIndex = 10;
			this.lblObject.Text = "Nhà cung cấp :";
			this.lblObject.TextAlign = ContentAlignment.MiddleRight;
			this.cbbTypeBill.BackColor = Color.White;
			this.cbbTypeBill.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbTypeBill.FlatStyle = FlatStyle.Flat;
			this.cbbTypeBill.Font = new Font("Arial", 8f, FontStyle.Bold);
			this.cbbTypeBill.FormattingEnabled = true;
			this.cbbTypeBill.Items.AddRange(new object[]
			{
				"Chọn loại hoá đơn cần tìm",
				"Hoá đơn nhập hàng",
				"Hoá đơn xuất hàng"
			});
			this.cbbTypeBill.Location = new System.Drawing.Point(226, 19);
			this.cbbTypeBill.Name = "cbbTypeBill";
			this.cbbTypeBill.Size = new Size(213, 22);
			this.cbbTypeBill.TabIndex = 42;
			this.cbbTypeBill.SelectedIndexChanged += new EventHandler(this.cbbTypeBill_SelectedIndexChanged);
			this.cbbTypeBill.SelectedValueChanged += new EventHandler(this.cbbTypeBill_SelectedIndexChanged);
			this.groupBox2.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.groupBox2.Controls.Add(this.label25);
			this.groupBox2.Controls.Add(this.label17);
			this.groupBox2.Controls.Add(this.dtpTo);
			this.groupBox2.Controls.Add(this.dtpFrom);
			this.groupBox2.Controls.Add(this.btnSearch);
			this.groupBox2.Controls.Add(this.txtSearch);
			this.groupBox2.Controls.Add(this.lblObjectSearch);
			this.groupBox2.Controls.Add(this.cbbTypeBill);
			this.groupBox2.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.groupBox2.Location = new System.Drawing.Point(7, 5);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new Size(886, 51);
			this.groupBox2.TabIndex = 43;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "Tìm kiếm hoá đơn";
			this.label25.AutoSize = true;
			this.label25.Font = new Font("Arial", 9f);
			this.label25.Location = new System.Drawing.Point(7, 23);
			this.label25.Name = "label25";
			this.label25.Size = new Size(22, 15);
			this.label25.TabIndex = 161;
			this.label25.Text = "Từ";
			this.label17.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
//			this.label17.Image = (Image)componentResourceManager.GetObject("label17.Image");
			this.label17.Location = new System.Drawing.Point(115, 18);
			this.label17.Name = "label17";
			this.label17.Size = new Size(20, 25);
			this.label17.TabIndex = 160;
			this.dtpTo.CustomFormat = "dd/MM/yyyy";
			this.dtpTo.Font = new Font("Arial", 9f);
			this.dtpTo.Format = DateTimePickerFormat.Custom;
			this.dtpTo.Location = new System.Drawing.Point(137, 20);
			this.dtpTo.Name = "dtpTo";
			this.dtpTo.Size = new Size(81, 21);
			this.dtpTo.TabIndex = 159;
			this.dtpFrom.CustomFormat = "dd/MM/yyyy";
			this.dtpFrom.Font = new Font("Arial", 9f);
			this.dtpFrom.Format = DateTimePickerFormat.Custom;
			this.dtpFrom.Location = new System.Drawing.Point(31, 20);
			this.dtpFrom.Name = "dtpFrom";
			this.dtpFrom.Size = new Size(81, 21);
			this.dtpFrom.TabIndex = 158;
			this.btnSearch.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.btnSearch.BackColor = Color.White;
			this.btnSearch.FlatAppearance.BorderColor = Color.Cyan;
			this.btnSearch.FlatStyle = FlatStyle.Flat;
			this.btnSearch.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
//			this.btnSearch.Image = (Image)componentResourceManager.GetObject("btnSearch.Image");
			this.btnSearch.Location = new System.Drawing.Point(855, 19);
			this.btnSearch.Name = "btnSearch";
			this.btnSearch.Size = new Size(21, 21);
			this.btnSearch.TabIndex = 45;
			this.btnSearch.UseVisualStyleBackColor = false;
			this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
			this.txtSearch.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtSearch.Font = new Font("Arial", 9.5f);
			this.txtSearch.Location = new System.Drawing.Point(602, 19);
			this.txtSearch.Name = "txtSearch";
			this.txtSearch.Size = new Size(249, 22);
			this.txtSearch.TabIndex = 44;
			this.lblObjectSearch.BackColor = Color.White;
			this.lblObjectSearch.Location = new System.Drawing.Point(445, 19);
			this.lblObjectSearch.Name = "lblObjectSearch";
			this.lblObjectSearch.Size = new Size(152, 22);
			this.lblObjectSearch.TabIndex = 43;
			this.lblObjectSearch.TextAlign = ContentAlignment.MiddleRight;
			this.label5.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.label5.BackColor = Color.White;
			this.label5.Location = new System.Drawing.Point(233, 562);
			this.label5.Name = "label5";
			this.label5.Size = new Size(660, 32);
			this.label5.TabIndex = 47;
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			base.ClientSize = new Size(900, 600);
			base.Controls.Add(this.groupBox2);
			base.Controls.Add(this.dgvBill);
			base.Controls.Add(this.btnClose);
			base.Controls.Add(this.btnPrint);
			base.Controls.Add(this.dgvProduct);
			base.Controls.Add(this.cbbProvider);
			base.Controls.Add(this.lblObject);
			base.Controls.Add(this.groupBox1);
			base.Controls.Add(this.label5);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			//base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.KeyPreview = true;
			base.Name = "frmBill";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "HOÁ ĐƠN";
			base.WindowState = FormWindowState.Maximized;
			base.Load += new EventHandler(this.frmInput_Load);
			base.KeyDown += new KeyEventHandler(this.frmInput_KeyDown);
			((ISupportInitialize)this.dgvProduct).EndInit();
			((ISupportInitialize)this.dgvBill).EndInit();
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			this.groupBox2.ResumeLayout(false);
			this.groupBox2.PerformLayout();
			base.ResumeLayout(false);
		}
	}
}
